<?php

namespace GamesBundle\Command;

use GamesBundle\Entity\GameNperRecord;
use GamesBundle\Entity\User;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class GetLotteryCommand extends ContainerAwareCommand
{
    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this
            ->setName('games:curl_get_lottery')
            ->setDescription('采集最新一条数据的脚本');
    }

    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln([
            '采集数据中...',// A line
            '============',// Another line
            '',// Empty line
        ]);

        $handle = $this->getContainer()->get('games_handle_order_data');
        $handle->getNper();
        // Now you can get repositories
        // $usersRepo = $em->getRepository("myBundle:Users");
        // $user = $usersRepo->find(1);

        // outputs multiple lines to the console (adding "\n" at the end of each line)

        $output->writeln('执行成功！');
    }
}